﻿<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>webcom管理ページ</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="全消去" />
        <br />
        <br />
        <asp:GridView ID="GridView1" runat="server" AllowSorting="True" AutoGenerateColumns="False"
            CellPadding="4" DataKeyNames="id" DataSourceID="SqlDataSource1" EmptyDataText="表示するデータ レコードがありません。"
            ForeColor="#333333" GridLines="None" AllowPaging="True">
            <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
            <Columns>
                <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />
                <asp:BoundField DataField="id" HeaderText="id" ReadOnly="True" SortExpression="id" />
                <asp:BoundField DataField="timestamp" HeaderText="timestamp" SortExpression="timestamp" />
                <asp:BoundField DataField="usergroup" HeaderText="usergroup" SortExpression="usergroup" />
                <asp:BoundField DataField="sender" HeaderText="sender" SortExpression="sender" />
                <asp:BoundField DataField="destination" HeaderText="destination" SortExpression="destination" />
                <asp:BoundField DataField="message" HeaderText="message" SortExpression="message" />
            </Columns>
            <RowStyle BackColor="#EFF3FB" />
            <EditRowStyle BackColor="#2461BF" />
            <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
            <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
            <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
            <AlternatingRowStyle BackColor="White" />
        </asp:GridView>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:DatabaseConnectionString1 %>"
            DeleteCommand="DELETE FROM [LogTable] WHERE [id] = @id" InsertCommand="INSERT INTO [LogTable] ([timestamp], [usergroup], [sender], [destination], [message]) VALUES (@timestamp, @usergroup, @sender, @destination, @message)"
            ProviderName="<%$ ConnectionStrings:DatabaseConnectionString1.ProviderName %>"
            SelectCommand="SELECT [id], [timestamp], [usergroup], [sender], [destination], [message] FROM [LogTable]"
            UpdateCommand="UPDATE [LogTable] SET [timestamp] = @timestamp, [usergroup] = @usergroup, [sender] = @sender, [destination] = @destination, [message] = @message WHERE [id] = @id">
            <DeleteParameters>
                <asp:Parameter Name="id" Type="Int32" />
            </DeleteParameters>
            <UpdateParameters>
                <asp:Parameter Name="timestamp" Type="DateTime" />
                <asp:Parameter Name="usergroup" Type="String" />
                <asp:Parameter Name="sender" Type="String" />
                <asp:Parameter Name="destination" Type="String" />
                <asp:Parameter Name="message" Type="String" />
                <asp:Parameter Name="id" Type="Int32" />
            </UpdateParameters>
            <InsertParameters>
                <asp:Parameter Name="timestamp" Type="DateTime" />
                <asp:Parameter Name="usergroup" Type="String" />
                <asp:Parameter Name="sender" Type="String" />
                <asp:Parameter Name="destination" Type="String" />
                <asp:Parameter Name="message" Type="String" />
            </InsertParameters>
        </asp:SqlDataSource>
        <br />
        <asp:Button ID="Button2" runat="server" OnClick="Button2_Click" Text="ReadLogTest" />
        <asp:Button ID="Button3" runat="server" OnClick="Button3_Click" Text="WriteLogTest" /><br />
        <asp:TextBox ID="TextBox1" runat="server" Height="134px" Width="618px"></asp:TextBox>
        <br />
        <br />
        <asp:TextBox ID="TextBox2" runat="server">25080</asp:TextBox>
        <asp:Button ID="Button4" runat="server" OnClick="Button4_Click" 
            Text="WriteDummyLog" style="margin-top: 0px" /></div>
    </form>
</body>
</html>
